$(document).ready(function (){
require(['inputdrop'] ,function (inputdrop){

var index_list_url = "siem/logfilter/queryLogFilterList";

var index_list_col_header = [
							  {name:"",text:"" ,hideSearch:"hide",width:3},
							  {text : "策略名称" ,name : "apName",align:"left",width:23},
							  {text : "代理服务器" ,name : "nodeName",align:"left",width:19,searchRender : function (el){
							   	    secEl = $('<div class="inputdrop" id="nodeId"></div>');
							   	    g_formel.code_list_render({
								   	   	key : "agentConfigList",
										agentEl : secEl
									});
							   	   el.append(secEl);
							  }},
							  {text : "策略状态" ,name : "apStatusName",align:"left",width:17,searchRender:function (el){
									var data = [
													{text:"----" ,id:"-1"},
							  						{text:"启用" ,id:"1"},
							  						{text:"停用" ,id:"0"}
										  		];
									g_formel.select_render(el ,{
										data : data,
										name : "apStatus"
									});
							  }},
							  {text : "创建时间" ,name : "enterDate",align:"left",width:19 ,hideSearch:true},
							  {text : "修改时间" ,name : "updateTime",align:"left",width:19,searchRender:function (el){
									index_render_div(el ,{type:"date", startKey:"enterStartDate" ,endKey:"enterEndDate"});
							  }}
							];

var index_list_col_oper = [
				  			  {icon : "rh-icon rh-edit" ,text : "修改" ,aclick :edit_template_init},
				  			  {icon : "rh-icon rh-delete" ,text : "删除" ,aclick :index_list_delete}
			   			  ];

var list_add_url = "siem/logfilter/addLogFilter";

var list_update_url = "siem/logfilter/updLogFilter";

var list_delete_url = "siem/logfilter/delLogFilter";

var form_iplist_col_header1 = [
							  {text:'应用事件名称',name:"alarmNameKey",align:"left"}
							 ];

var form_iplist_col_header = [
							  {text:'IP类型',name:"ipTypeName",align:"left",width:35},
							  {text:'IP范围',name:"ipRange",align:"left",width:65}
							 ];

var ipTypeObj = {
					"0":"源IP",
					"1":"目的IP",
					"2":"发生源"
				}

index_list_get({paramObj:null,isLoad:true,maskObj:"body"});

event_init();

function event_init ()
{
	$("#add_btn").click(function (){
		edit_template_init();
	});

	index_list_search_render($("um-search") ,{
		cbf : function (val){
			g_grid.refresh($("#table_div") ,{
				paramObj : {apName : val}
			})
		},
		placeholder : "请输入策略名称"
	})
}

function index_list_get(option)
{
	g_grid.render($("#table_div") ,{
 		header : index_list_col_header,
 		oper : index_list_col_oper,
 		operWidth : "100px",
 		dbIndex:1,
 		url : index_list_url,
 		paramObj : option.paramObj,
 		isLoad : option.isLoad,
 		maskObj : option.maskObj,
 		allowCheckBox : false,
 		dbClick : detail_template_init,
 		hasBorder : false,
		autoHeight : true,
		showCount : true
	});
}

function edit_template_init (rowData)
{
	var title = rowData ? "日志过滤策略修改" : "日志过滤策略添加";
	$.ajax({
		type: "GET",
		url: "module/policy_manage/log_filter_policy_tpl.html",
		success : function(data){
			g_dialog.dialog($(data).find("[id=edit_template]") ,{
				width : "900px",
				init : init,
				initAfter : initAfter,
				title : title,
				saveclick : save_click,
				autoHeight : "autoHeight"
			});
		}
	});

	function init (el)
	{
		g_validate.init(el);
		// 天、月、周change事件
		var el_apCycle = el.find("[data-id=apCycle]");
		var el_eipCyclePeriod = el.find("[data-id=apCyclePeriod]");
		var el_validityStart = el.find("[data-id=validityStart]");
		var el_validityEnd = el.find("[data-id=validityEnd]");

		el_apCycle.change(function(){
			var tmp = $(this).val();
			el_eipCyclePeriod.removeAttr("disabled");
			el_eipCyclePeriod.find("option").remove();
			el_eipCyclePeriod.trigger("change");
			
			if (tmp == "3")
			{
				// 添加1-28天
				for (var i = 1; i < 29; i++)
				{
					el_eipCyclePeriod.append('<option value="'+i+'">'+i+'</option>');
				}
				el_validityStart.removeAttr("disabled");
				el_validityEnd.removeAttr("disabled");
			}
			else if (tmp == "2")
			{
				// 添加周一至周日
				el_eipCyclePeriod.removeAttr("disabled");
				el_eipCyclePeriod.append('<option value="0">星期日</option>');
				el_eipCyclePeriod.append('<option value="1">星期一</option>');
				el_eipCyclePeriod.append('<option value="2">星期二</option>');
				el_eipCyclePeriod.append('<option value="3">星期三</option>');
				el_eipCyclePeriod.append('<option value="4">星期四</option>');
				el_eipCyclePeriod.append('<option value="5">星期五</option>');
				el_eipCyclePeriod.append('<option value="6">星期六</option>');

				el_validityStart.removeAttr("disabled");
				el_validityEnd.removeAttr("disabled");
			}
			else if (tmp == "1")
			{
				el_eipCyclePeriod.attr("disabled","disabled");
				el_validityStart.removeAttr("disabled");
				el_validityEnd.removeAttr("disabled");
			}
			else
			{
				el_eipCyclePeriod.attr("disabled","disabled");
				el_validityStart.attr("disabled","disabled");
				el_validityEnd.attr("disabled","disabled");
				el_validityStart.val("");
				el_validityEnd.val("");
				g_validate.clear([el_validityStart,el_validityEnd]);
			}
			$("[data-id=eipCyclePeriod]").trigger("change");

		});
       
		el_validityStart.click(function(){
			if($(this).val() == "")
			{
				$(this).val("00:00:00");
			}				
		});
		el_validityEnd.click(function(){
			if($(this).val() == "")
			{
				$(this).val("00:00:00");
			}				
		});

		// 渲染代理服务器
		g_formel.code_list_render({
			key : "agentConfigList",
			agentEl : el.find("[id=nodeId]")
		});

		// 渲染资产类型
		g_formel.code_list_render({
			key : "deviceAssetTypeSiemTree",
			deviceTypeEl : el.find("[id=deviceType]"),
			deviceTypeCb : function (id){
				sample_list_get(id)
			}
		});

		// 第一个表格的右移事件
		var el_table_right1 = el.find("[id=ipList_table1]");

		el.find("[id=chevron-right1]").click(function (){
			if (!g_validate.validate($("#left1")))
			{
				return false;
			}
			var buffer = [];
			var obj = new Object();
			obj.alarmNameKey = el.find("[data-id=emailTitle]").val();
			buffer.push(obj);
			g_grid.addData(el_table_right1,buffer);
			el.find("[data-id=emailTitle]").val("");
		});

		g_grid.render(el_table_right1,{
			data:[],
			header:form_iplist_col_header1,
			paginator:false,
			isLoad:false,
			hideSearch:true
		});

		// 第一个表格的左移事件
		el.find("[id=chevron-left1]").click(function (){
			var data = g_grid.getData(el.find("#ipList_table1") ,{chk:true});
			if (data.length == 0)
			{
				g_dialog.operateAlert(el ,"请选择一条记录。" ,"error");
			}
			if (data.length > 1)
			{
				g_dialog.operateAlert(el ,"只允许选择一条记录。" ,"error");
			}
			g_grid.removeData(el.find("[id=ipList_table1]"));
			el.find("[data-id=emailTitle]").val(data[0].ipTypeN);
		});
	}

	function initAfter (el)
	{
		var eventType;
		// 获取第一个表格的数据
		um_ajax_get({
			url : "siem/eventIgnore/queryEventKindInfo",
			maskObj : el,
			successCallBack : function(data){
				data.unshift({eventKindName:"---" ,eventKindId:"-11"});
				g_formel.selectEl_render(el.find("[data-id=eventTypeComboBox]"),{
					data : data,
					text : "eventKindName",
					id : "eventKindId"
				});
				eventType = el.find("[data-id=eventTypeComboBox]").val();
			}
		});
		
		el.find("[data-id=eventTypeComboBox]").change(function(){
			eventType = el.find("[data-id=eventTypeComboBox]").val();
			event_list_get(eventType);
		});

		var el_table_left2 = el.find("[id=eventList_left_table2]");
		var el_table_right2 = el.find("[id=eventList_right_table2]");

		// 第二个左右按钮点击事件
		el.find("[id=chevron-left2]").click(function (){
			var rightDataArray = g_grid.getData(el_table_right2 ,{chk:true});
			if (rightDataArray.length == 0)
			{
				g_dialog.operateAlert(el ,index_select_one_at_least_msg ,"error");
				return false;
			}
			g_grid.removeData(el_table_right2);
			var eventType = el.find("[data-id=eventTypeComboBox]").val();
			event_list_get(eventType);
		});

		el.find("[id=chevron-right2]").click(function (){
			var leftDataArray = g_grid.getData(el_table_left2 ,{chk:true});
			if (leftDataArray.length == 0)
			{
				g_dialog.operateAlert(el ,index_select_one_at_least_msg ,"error");
				return false;
			}
			g_grid.removeData(el_table_left2);
			g_grid.addData(el_table_right2 ,leftDataArray);
		});

		g_grid.render(el_table_left2,{
			 header:[{text:"事件名称",name:"eventName",align:"left"}],
			 data:[],
			 hideSearch:true,
			 paginator:false
		});

		g_grid.render(el_table_right2,{
			 header:[{text:"事件名称",name:"eventName",align:"left"}],
			 data:[],
			 hideSearch:true,
			 paginator:false
		});

		// 第三个list
		var el_table_left3 = el.find("[id=eventList_left_table3]");
		var el_table_right3 = el.find("[id=eventList_right_table3]");

		g_formel.code_list_render({
			key : "deviceAssetTypeSiemTree",
			deviceTypeEl : el.find("[id=eventTypeComboBox3]"),
			deviceTypeCb : function (id){
				sample_list_get(id)
			}
		});

		g_grid.render(el_table_left3,{
			 header:[{text:"样本名称",name:"alarmName",align:"left"}],
			 data:[],
			 hideSearch:true,
			 paginator:false
		});
		
		g_grid.render(el_table_right3,{
			 header:[{text:"样本名称",name:"alarmName",align:"left"}],
			 data:[],
			 hideSearch:true,
			 paginator:false
		});

		// 第三个左右按钮点击事件
		el.find("[id=chevron-left3]").click(function (){
			var rightDataArray = g_grid.getData(el_table_right3 ,{chk:true});
			if (rightDataArray.length == 0)
			{
				g_dialog.operateAlert(el ,index_select_one_at_least_msg ,"error");
				return false;
			}
			g_grid.removeData(el_table_right3);
			var eventType = el.find("[data-id=eventTypeComboBox3]").val();
			sample_list_get(eventType);
		});

		el.find("[id=chevron-right3]").click(function (){
			var leftDataArray = g_grid.getData(el_table_left3 ,{chk:true});
			if (leftDataArray.length == 0)
			{
				g_dialog.operateAlert(el ,index_select_one_at_least_msg ,"error");
				return false;
			}
			g_grid.removeData(el_table_left3);
			g_grid.addData(el_table_right3 ,leftDataArray);
		});

		// 第四个list
		var ipList_table = el.find("[id=ipList_table4]");

		g_grid.render(ipList_table,{
			data:[],
			header:form_iplist_col_header,
			paginator:false,
			isLoad:false,
			hideSearch:true
		});

		var el_startIp = el.find("[data-id=startIp]");
		var el_endIp = el.find("[data-id=endIp]");
		var el_ipV6 = el.find("[data-id=ipV6]");

		// IP类型点击事件
		var ipVersion_radio = el.find("[name=ipVersion]")
		ipVersion_radio.click(function (){
			if ($(this).val() == "0")
			{
				el_startIp.removeAttr("disabled");
				el_endIp.removeAttr("disabled");
				el_ipV6.attr("disabled" ,"disabled");
				g_validate.clear(el_ipV6);
				el_ipV6.val("");
			}
			else
			{
				el_startIp.attr("disabled" ,"disabled");
				el_endIp.attr("disabled" ,"disabled");
				el_ipV6.removeAttr("disabled");
				g_validate.clear([el_startIp ,el_endIp]);
				el_startIp.val("");
				el_endIp.val("");
			}
		});

		// 右移事件
		var ipList = [];
		el.find("[id=chevron-right]").click(function (){
			if (!g_validate.validate($("#left")))
			{
				return false;
			}
			if (!g_validate.ipValidate(el.find("[data-id=startIp]") ,el.find("[data-id=endIp]"))){
				return false;
			}	
			el.find("[name=ipType]").each(function (){
				if ($(this).is(":checked"))
				{
					var obj = new Object();
					obj.ipType = $(this).val();
					obj.ipTypeName = $(this).closest("label").find("span").text();
					obj.ipAddrType = el.find("[name=ipVersion]:checked").val();
					obj.startIp = el_startIp.val();
					obj.endIp = el_endIp.val();
					obj.ipV6 = el_ipV6.val();
					obj.startIp && (obj.ipRange = obj.startIp + "-" + obj.endIp);
					obj.ipV6 && (obj.ipRange = obj.ipV6);
					ipList.push(obj);
				}
			});
			if (ipList.length == 0)
			{
				g_dialog.operateAlert(el ,"请选择IP类型" ,"error");
				return false;
			}
			g_grid.addData(el.find("[id=ipList_table4]") ,ipList);

			el.find("[id=left]").find("[type=text]").val("");
			el.find("[name=ipType]").removeAttr("checked");
			ipList = [];
		});

		// 左移事件
		el.find("[id=chevron-left]").click(function (){
			var data = g_grid.getData(el.find("#ipList_table4") ,{chk:true});
			if (data.length == 0)
			{
				g_dialog.operateAlert(el ,"请选择一条记录。" ,"error");
			}
			else if (data.length > 1)
			{
				g_dialog.operateAlert(el ,"只允许选择一条记录。" ,"error");
			}
			else 
			{
				el.find("[name=ipType][value="+data[0].ipType+"]")[0].checked =true;
				el.find("[name=ipVersion][value="+data[0].ipAddrType+"]").click();
				if(data[0].ipRange.indexOf("-")>0)
				{	
					var array = data[0].ipRange.split("-");
					el_startIp.val(array[0]);
					el_endIp.val(array[1]);
				}
				else 
				{
					el_ipV6.val(data[0].ipRange);
				}
			}
			g_grid.removeData(el.find("[id=ipList_table4]"));	
		});

		// 数据回显
      	if (rowData)
	  	{
		  um_ajax_get({
			  url :"siem/logfilter/queryLogFilter",
			  paramObj : {id:rowData.apId},
			  isLoad: false,
			  successCallBack : function (data){
				  edit_template_render(el ,data ,rowData);									  
			  }
		  });
	   }
	}

	function save_click (el ,saveObj)
	{
		if (!g_validate.validate($("#base_info"))){
			return false;
		}

		if ((saveObj.validityStart && saveObj.validityEnd)
			&& (saveObj.validityStart > saveObj.validityEnd))
		{
			g_validate.setError($("[data-id=validityEnd]") ,"开始时间不能大于结束时间")
			return false;
		}

		//确定之前不校验左边的ip
		el.find("[data-id=ipV6]").removeAttr("validate");
		el.find("[data-id=startIp]").removeAttr("validate");
		el.find("[data-id=endIp]").removeAttr("validate");

		var flag = true;

		if (!flag)
		{
			el.find("[data-id=ipV6]").attr("validate","required,ipv6");
			el.find("[data-id=startIp]").attr("validate","required,ipv4");
			el.find("[data-id=endIp]").attr("validate","required,ipv4");
			return false;
		}

		var obj = {};
		obj.logFilterStore = saveObj;

		obj.alarmStore = g_grid.getData(el.find("[id=ipList_table1]"));
		obj.eventStore = g_grid.getData(el.find("[id=eventList_right_table2]"));
		obj.sampleStore = g_grid.getData(el.find("[id=eventList_right_table3]"));
		obj.ipRecordStore = g_grid.getData(el.find("[id=ipList_table4]"));

		for (var i = 0; i < obj.ipRecordStore.length; i++) {
			if (obj.ipRecordStore[i].ipV6)
			{
				obj.ipRecordStore[i].startIp = obj.ipRecordStore[i].ipV6;
				obj.ipRecordStore[i].endIp = obj.ipRecordStore[i].ipV6;
			}
			obj.ipRecordStore[i].ipRadioStatus = obj.ipRecordStore[i].ipAddrType;
		}

		if (saveObj.eventGrade)
		{
			obj.logFilterStore.eventGrade = saveObj.eventGrade.join(",");
		}

		var flag_url = list_add_url;

		if (rowData)
		{
			flag_url = list_update_url;
			obj.logFilterStore.apId = rowData.apId;
		}

		if (!obj.logFilterStore.apCycle)
		{
			obj.logFilterStore.apCycle = -1
		}

		um_ajax_post({
			url : flag_url,
			paramObj : obj,
			maskObj : el,
			successCallBack : function (data){
				g_dialog.operateAlert(null ,"操作成功！");
				g_dialog.hide(el);
				index_list_get({paramObj:null,isLoad:true,maskObj:"body"});
			}
		});
	}
}

function event_list_get(eventType)
{
	var el = $("#edit_template");
	var eventType = eventType;
	var eventStore = g_grid.getData(el.find("[id=eventList_right_table2]"));
	g_grid.render(el.find("[id=eventList_left_table2]"),{
		 header:[{text:"事件名称",name:"eventName",align:"left"}],
		 url:"siem/eventIgnore/queryEventNoSelected",
		 paramObj:{eventType:eventType,eventStore:eventStore},
		 isLoad:false,
		 maskObj:"body",
		 hideSearch:true,
		 paginator:false
	});
}

function sample_list_get(deviceTypeId)
{
	var el = $("#edit_template");
	var sampleStore = g_grid.getData(el.find("[id=eventList_right_table3]"));
	g_grid.render(el.find("[id=eventList_left_table3]"),{
		 header:[{text:"样本名称",name:"alarmName",align:"left"}],
		 url:"knowledge/logsample/querySampleNoSelected",
		 paramObj:{deviceType:deviceTypeId,sampleStore:sampleStore},
		 isLoad:false,
		 maskObj:"body",
		 hideSearch:true,
		 paginator:false
	});
}

function edit_template_render(el ,data ,rowData)
{
	//回显input和下拉框
	el.umDataBind("render" ,rowData);

	// 回显事件等级
	el.find("[data-id=eventGrade]").val(data.logFilterStore.eventGrade.split(","));
	el.find("[data-id=eventGrade]").oneTime(10 ,function (){
		el.find("[data-id=eventGrade]").trigger("change");
	});

	// 回显策略状态
	$("[data-id=apStatus]").val(data.logFilterStore.apStatus)
	$("[data-id=apStatus]").trigger("change")

	// 回显周期列表
	if (data.logFilterStore.apCycle != "0")
	{
		el.find("[data-id=apCycle]").val(data.logFilterStore.apCycle);
		el.find("[data-id=apCycle]").trigger("change");

		el.find("[data-id=apCyclePeriod]").val(data.logFilterStore.apCyclePeriod);
		el.find("[data-id=apCyclePeriod]").trigger("change");

		el.find("[data-id=validityStart]").val(data.logFilterStore.validityStart);
		el.find("[data-id=validityEnd]").val(data.logFilterStore.validityEnd);
	}
    
    console.log(data);
	// 渲染日志收集代理
	inputdrop.setDataSelect(el.find("[id=nodeId]") ,data.logFilterStore.nodeId);

	// 渲染资产类型
	inputdrop.setDataTree(el.find("[id=deviceType]") ,data.logFilterStore.deviceType);



	// 渲染应用事件
	g_grid.addData(el.find("[id=ipList_table1]") ,data.alarmStore);

	// 渲染事件类型
	g_grid.addData(el.find("[id=eventList_right_table2]") ,data.eventStore);

	// 渲染样本
	g_grid.addData(el.find("[id=eventList_right_table3]") ,data.sampleStore);

	// 回显IPLIST
	for (var i = 0; i < data.ipRecordStore.length; i++)
	{
		data.ipRecordStore[i].ipRange = data.ipRecordStore[i].ipAllName;
		data.ipRecordStore[i].ipTypeName = ipTypeObj[data.ipRecordStore[i].ipType];
		data.ipRecordStore[i].ipAddrType = data.ipRecordStore[i].ipRadioStatus;
	}
	g_grid.addData(el.find("[id=ipList_table4]") ,data.ipRecordStore);
}

function index_list_delete (rowData)
{
	g_dialog.operateConfirm("确认删除此记录么" ,{
		saveclick : function (){
			um_ajax_post({
				url : list_delete_url,
				paramObj : {apId: rowData.apId},
				successCallBack : function(data){
					g_grid.refresh($("#table_div"));
					g_dialog.operateAlert(null ,"操作成功！");
				}
			});
		}
	});
}

function detail_template_init (rowData)
{
	$.ajax({
		type: "GET",
		url: "module/policy_manage/log_filter_policy_tpl.html",
		success :function(data)
		{
			g_dialog.dialog($(data).find("[id=detail_template]"),{
				width : "900px",
				init : init,
				initAfter : initAfter,
				title : "日志过滤策略详细信息",
				isDetail : true,
				autoHeight:"autoHeight"
			});
		}
	});

	function init (el)
	{
		var apply_event_header = [
						{text:"",name:"",width:5},
						{text:'应用事件名称',name:"alarmNameKey",align:"left"}
				   ];
		g_grid.render(el.find("[id=apply_event_div]"),{
			data:[],
			header:apply_event_header,
	 		paginator:false,
			isLoad:false,
			allowCheckBox:false,
			hideSearch:true
		});

		var event_type_header = [
						{text:"",name:"",width:5},
						{text:'事件类别',name:"eventName",align:"left"}
				   ];
		g_grid.render(el.find("[id=event_type_div]"),{
			data:[],
			header:event_type_header,
	 		paginator:false,
			isLoad:false,
			allowCheckBox:false,
			hideSearch:true
		});

		var log_sample_header = [
						{text:"",name:"",width:5},
						{text:'样本名称',name:"alarmName",align:"left"}
				   ];
		g_grid.render(el.find("[id=log_sample_div]"),{
			data:[],
			header:log_sample_header,
	 		paginator:false,
			isLoad:false,
			allowCheckBox:false,
			hideSearch:true
		});

		var source_ip_header = [
						{text:"",name:"t",width:5},
						{text:'IP类型',name:"ipTypeName",align:"left"},
						{text:'IP',name:"ipAllName",align:"left"}
				   ];
		g_grid.render(el.find("[id=source_ip_div]"),{
			data:[],
			header:source_ip_header,
	 		paginator:false,
			isLoad:false,
			allowCheckBox:false,
			hideSearch:true
		});
	}

	function initAfter (el)
	{
		um_ajax_get({
			url : "siem/logfilter/queryLogFilter",
			paramObj : {id:rowData.apId},
			maskObj : el,
			successCallBack : function (data){
				el.umDataBind("render" ,data.logFilterStore);
				g_grid.addData(el.find("[id=apply_event_div]") ,data.alarmStore);
				g_grid.addData(el.find("[id=event_type_div]") ,data.eventStore);
				g_grid.addData(el.find("[id=log_sample_div]") ,data.sampleStore);
				g_grid.addData(el.find("[id=source_ip_div]") ,data.ipRecordStore);
				// 回显周期列表
				var apCycle;
				var apCyclePeriod;
				if(data.logFilterStore.apCycle == "1")
				{
					apCycle = "天";
					apCyclePeriod = "";
				}
				else if(data.logFilterStore.apCycle == "2")
				{
					apCycle = "周";
					switch(data.logFilterStore.apCyclePeriod)
					{
						case "0":
						apCyclePeriod =  "日";
						break;
						case "1":
						apCyclePeriod =  "一";
						break;
						case "2":
						apCyclePeriod =  "二";
						break;
						case "3":
						apCyclePeriod =  "三";
						break;
						case "4":
						apCyclePeriod =  "四";
						break;
						case "5":
						apCyclePeriod =  "五";
						break;
						case "6":
						apCyclePeriod =  "六";
						break;
					}
				}
				else if(data.logFilterStore.apCycle == "3")
				{
					apCycle = "月";
					apCyclePeriod = data.logFilterStore.apCyclePeriod+"日";
				}

				console.log(data.logFilterStore.apCycle)

				if(data.logFilterStore.apCycle != null && data.logFilterStore.apCycle != "0"
					&& data.logFilterStore.apCycle != -1)
				{
					el.find("[data-id=circle_info]").text("每"+apCycle+apCyclePeriod+" "+data.logFilterStore.validityStart+"-"+data.logFilterStore.validityEnd);
				}
				else
				{
					el.find("[data-id=circle_info]").text("无");
				}
			}
		});			
	}
}



});
});